<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class RDoc::RD::BlockParser - rdoc: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../../Racc/Parser.html">Racc::Parser</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-add_footnote">#add_footnote</a>
    <li ><a href="#method-i-add_label">#add_label</a>
    <li ><a href="#method-i-content">#content</a>
    <li ><a href="#method-i-cut_off">#cut_off</a>
    <li ><a href="#method-i-format_line_num">#format_line_num</a>
    <li ><a href="#method-i-get_included">#get_included</a>
    <li ><a href="#method-i-if_current_indent_equal">#if_current_indent_equal</a>
    <li ><a href="#method-i-line_index">#line_index</a>
    <li ><a href="#method-i-on_error">#on_error</a>
    <li ><a href="#method-i-paragraph">#paragraph</a>
    <li ><a href="#method-i-parse">#parse</a>
    <li ><a href="#method-i-parse_subtree">#parse_subtree</a>
    <li ><a href="#method-i-set_term_to_element">#set_term_to_element</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-RDoc::RD::BlockParser">
    <h1 id="class-RDoc::RD::BlockParser" class="class">
      class RDoc::RD::BlockParser
    </h1>

    <section class="description">
    
<p><a href="../RD.html"><code>RD</code></a> format parser for headings, paragraphs, lists, verbatim sections that exist as blocks.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-footnotes" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">footnotes</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Footnotes for this document</p>
              </div>
            </div>
          <div id="attribute-i-include_path" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">include_path</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>Path to find included files in</p>
              </div>
            </div>
          <div id="attribute-i-labels" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">labels</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Labels for items in this document</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="BlockParser.html"><code>RDoc::RD::BlockParser</code></a>.  Use <a href="BlockParser.html#method-i-parse"><code>parse</code></a> to parse an rd-format document.</p>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 709</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
  <span class="ruby-ivar">@inline_parser</span> = <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">RD</span><span class="ruby-operator">::</span><span class="ruby-constant">InlineParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">self</span>
  <span class="ruby-ivar">@include_path</span> = []

  <span class="ruby-comment"># for testing</span>
  <span class="ruby-ivar">@footnotes</span> = []
  <span class="ruby-ivar">@labels</span>    = {}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-add_footnote" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_footnote</span><span
                                class="method-args">(content)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds footnote <code>content</code> to the document</p>

                              <div class="method-source-code" id="add_footnote-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 1059</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_footnote</span> <span class="ruby-identifier">content</span>
  <span class="ruby-identifier">index</span> = <span class="ruby-ivar">@footnotes</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>

  <span class="ruby-identifier">footmark_link</span> = <span class="ruby-node">&quot;{^#{index}}[rdoc-label:footmark-#{index}:foottext-#{index}]&quot;</span>

  <span class="ruby-ivar">@footnotes</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">Paragraph</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">footmark_link</span>, <span class="ruby-string">&#39; &#39;</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">content</span>)
  <span class="ruby-ivar">@footnotes</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">BlankLine</span>.<span class="ruby-identifier">new</span>

  <span class="ruby-identifier">index</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_label" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_label</span><span
                                class="method-args">(label)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds label <code>label</code> to the document</p>

                              <div class="method-source-code" id="add_label-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 1073</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_label</span> <span class="ruby-identifier">label</span>
  <span class="ruby-ivar">@labels</span>[<span class="ruby-identifier">label</span>] = <span class="ruby-keyword">true</span>

  <span class="ruby-identifier">label</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-content" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">content</span><span
                                class="method-args">(values)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Retrieves the content of <code>values</code> as a single String</p>

                              <div class="method-source-code" id="content-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 1042</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">content</span> <span class="ruby-identifier">values</span>
 <span class="ruby-identifier">values</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">content</span> }.<span class="ruby-identifier">join</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-line_index" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">line_index</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Current line number</p>

                              <div class="method-source-code" id="line_index-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 997</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">line_index</span>
  <span class="ruby-ivar">@i</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-on_error" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">on_error</span><span
                                class="method-args">(et, ev, _values)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Raises a ParseError when invalid formatting is found</p>

                              <div class="method-source-code" id="on_error-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 981</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_error</span>(<span class="ruby-identifier">et</span>, <span class="ruby-identifier">ev</span>, <span class="ruby-identifier">_values</span>)
  <span class="ruby-identifier">prv</span>, <span class="ruby-identifier">cur</span>, <span class="ruby-identifier">nxt</span> = <span class="ruby-identifier">format_line_num</span>(<span class="ruby-ivar">@i</span>, <span class="ruby-ivar">@i</span><span class="ruby-value">+1</span>, <span class="ruby-ivar">@i</span><span class="ruby-value">+2</span>)

  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParseError</span>, <span class="ruby-identifier">&lt;&lt;Msg</span>
<span class="ruby-value">
RD syntax error: line #{@i+1}:
  #{prv}  |#{@src[@i-1].chomp}
  #{cur}=&gt;|#{@src[@i].chomp}
  #{nxt}  |#{@src[@i+1].chomp}

</span><span class="ruby-identifier">Msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-paragraph" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">paragraph</span><span
                                class="method-args">(value)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a paragraph for <code>value</code></p>

                              <div class="method-source-code" id="paragraph-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 1049</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">paragraph</span> <span class="ruby-identifier">value</span>
  <span class="ruby-identifier">content</span> = <span class="ruby-identifier">cut_off</span>(<span class="ruby-identifier">value</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>).<span class="ruby-identifier">rstrip</span>
  <span class="ruby-identifier">contents</span> = <span class="ruby-ivar">@inline_parser</span>.<span class="ruby-identifier">parse</span> <span class="ruby-identifier">content</span>

  <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">Paragraph</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">contents</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-parse" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse</span><span
                                class="method-args">(src)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Parses <code>src</code> and returns an <a href="../Markup/Document.html"><code>RDoc::Markup::Document</code></a>.</p>

                              <div class="method-source-code" id="parse-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 721</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse</span> <span class="ruby-identifier">src</span>
  <span class="ruby-ivar">@src</span> = <span class="ruby-identifier">src</span>
  <span class="ruby-ivar">@src</span>.<span class="ruby-identifier">push</span> <span class="ruby-keyword">false</span>

  <span class="ruby-ivar">@footnotes</span> = []
  <span class="ruby-ivar">@labels</span>    = {}

  <span class="ruby-comment"># @i: index(line no.) of src</span>
  <span class="ruby-ivar">@i</span> = <span class="ruby-value">0</span>

  <span class="ruby-comment"># stack for current indentation</span>
  <span class="ruby-ivar">@indent_stack</span> = []

  <span class="ruby-comment"># how indented.</span>
  <span class="ruby-ivar">@current_indent</span> = <span class="ruby-ivar">@indent_stack</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;&quot;</span>)

  <span class="ruby-comment"># RDoc::RD::BlockParser for tmp src</span>
  <span class="ruby-ivar">@subparser</span> = <span class="ruby-keyword">nil</span>

  <span class="ruby-comment"># which part is in now</span>
  <span class="ruby-ivar">@in_part</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@part_content</span> = []

  <span class="ruby-ivar">@in_verbatim</span> = <span class="ruby-keyword">false</span>

  <span class="ruby-ivar">@yydebug</span> = <span class="ruby-keyword">true</span>

  <span class="ruby-identifier">document</span> = <span class="ruby-identifier">do_parse</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@footnotes</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">blankline</span> = <span class="ruby-identifier">document</span>.<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">pop</span>

    <span class="ruby-identifier">document</span>.<span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">Rule</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">document</span>.<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">concat</span> <span class="ruby-ivar">@footnotes</span>

    <span class="ruby-identifier">document</span>.<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">document</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-cut_off" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">cut_off</span><span
                                class="method-args">(src)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Cuts off excess whitespace in <code>src</code></p>

                              <div class="method-source-code" id="cut_off-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 945</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cut_off</span>(<span class="ruby-identifier">src</span>)
  <span class="ruby-identifier">ret</span> = []
  <span class="ruby-identifier">whiteline_buf</span> = []

  <span class="ruby-identifier">line</span> = <span class="ruby-identifier">src</span>.<span class="ruby-identifier">shift</span>
  <span class="ruby-regexp">/^\s*/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">line</span>

  <span class="ruby-identifier">indent</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">quote</span>(<span class="ruby-node">$&amp;</span>)
  <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">push</span>(<span class="ruby-node">$&#39;</span>)

  <span class="ruby-keyword">while</span> <span class="ruby-identifier">line</span> = <span class="ruby-identifier">src</span>.<span class="ruby-identifier">shift</span>
    <span class="ruby-keyword">if</span> <span class="ruby-regexp">/^(\s*)$/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">line</span>
      <span class="ruby-identifier">whiteline_buf</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">line</span>)
    <span class="ruby-keyword">elsif</span> <span class="ruby-regexp">/^#{indent}/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">line</span>
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">whiteline_buf</span>.<span class="ruby-identifier">empty?</span>
        <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">whiteline_buf</span>)
        <span class="ruby-identifier">whiteline_buf</span>.<span class="ruby-identifier">clear</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">push</span>(<span class="ruby-node">$&#39;</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;[BUG]: probably Parser Error while cutting off.\n&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">ret</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-format_line_num" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">format_line_num</span><span
                                class="method-args">(*line_numbers)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Formats line numbers <code>line_numbers</code> prettily</p>

                              <div class="method-source-code" id="format_line_num-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 1033</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">format_line_num</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">line_numbers</span>)
  <span class="ruby-identifier">width</span> = <span class="ruby-identifier">line_numbers</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">length</span> }.<span class="ruby-identifier">max</span>
  <span class="ruby-identifier">line_numbers</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-node">&quot;%#{width}d&quot;</span>, <span class="ruby-identifier">i</span>) }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_included" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_included</span><span
                                class="method-args">(file)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Retrieves the content for <code>file</code> from the <a href="BlockParser.html#attribute-i-include_path"><code>include_path</code></a></p>

                              <div class="method-source-code" id="get_included-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 1014</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_included</span>(<span class="ruby-identifier">file</span>)
  <span class="ruby-identifier">included</span> = []

  <span class="ruby-ivar">@include_path</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dir</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">file_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-identifier">dir</span>, <span class="ruby-identifier">file</span>

    <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">file_name</span> <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">included</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">readlines</span> <span class="ruby-identifier">file_name</span>
      <span class="ruby-keyword">break</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">included</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-if_current_indent_equal" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">if_current_indent_equal</span><span
                                class="method-args">(indent) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Yields to the given block if <code>indent</code> matches the current indent, otherwise an indentation token is processed.</p>

                              <div class="method-source-code" id="if_current_indent_equal-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 927</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">if_current_indent_equal</span>(<span class="ruby-identifier">indent</span>)
  <span class="ruby-identifier">indent</span> = <span class="ruby-identifier">indent</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/\t/</span>, <span class="ruby-string">&quot;\s&quot;</span> <span class="ruby-operator">*</span> <span class="ruby-value">8</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@current_indent</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">indent</span>
    <span class="ruby-ivar">@i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-comment"># next line</span>
    <span class="ruby-keyword">yield</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">indent</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@current_indent</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
    <span class="ruby-ivar">@indent_stack</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">indent</span>[<span class="ruby-ivar">@current_indent</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>])
    [<span class="ruby-value">:INDENT</span>, <span class="ruby-string">&quot;:INDENT&quot;</span>]
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@indent_stack</span>.<span class="ruby-identifier">pop</span>
    [<span class="ruby-value">:DEDENT</span>, <span class="ruby-string">&quot;:DEDENT&quot;</span>]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-parse_subtree" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse_subtree</span><span
                                class="method-args">(src)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Parses subtree <code>src</code></p>

                              <div class="method-source-code" id="parse_subtree-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 1004</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse_subtree</span> <span class="ruby-identifier">src</span>
  <span class="ruby-ivar">@subparser</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">RD</span><span class="ruby-operator">::</span><span class="ruby-constant">BlockParser</span>.<span class="ruby-identifier">new</span>

  <span class="ruby-ivar">@subparser</span>.<span class="ruby-identifier">parse</span> <span class="ruby-identifier">src</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-set_term_to_element" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">set_term_to_element</span><span
                                class="method-args">(parent, term)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="set_term_to_element-source">
            <pre><span class="ruby-comment"># File rdoc/rd/block_parser.rb, line 972</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_term_to_element</span>(<span class="ruby-identifier">parent</span>, <span class="ruby-identifier">term</span>)
<span class="ruby-comment">#  parent.set_term_under_document_struct(term, @tree.document_struct)</span>
  <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">set_term_without_document_struct</span>(<span class="ruby-identifier">term</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

